<template>
    <div>
        <el-form>
            <el-form-item label="价格">
                <el-input v-model.number="bill.value"></el-input>
            </el-form-item>
            <el-form-item label="客户名称">
                <el-input v-model="bill.customName"></el-input>
            </el-form-item>
            <el-button type="primary" @click="billUpload()">提交</el-button>
        </el-form>
    </div>
</template>

<script>

    export default {
        data: function () {
            return {
                bill: {
                    billCode: 0,
                    value: 10,
                    customName: 'lisi',
                    localDateTime: null,
                    operatorId: ''
                },



            }
        },
        computed: {},
        methods: {
            billUpload: function () {
                this.$http({
                    url: '/upload',
                    method: 'put',
                    data: this.bill
                }).then(res => {
                    this.$message.warning(res.status);
                    this.$message.warning(JSON.stringify(res.data))
                }, err => {

                    this.$message.warning(JSON.stringify(err.response.data));
                    if (err.response.status===401){
                        setTimeout(() => {
                            this.$router.push('/welcome');
                        }, 3000);
                    }

                }).catch(res => {
                    this.$message.warning(res.statusCode);
                    console.log(res.data());

                })
            },
            // change: function () {
            //     setTimeout(() => {
            //         this.$router.push('/welcome');
            //     }, 2000)
            // }
        },

        mounted: function () {

        },

        created: function () {

        },
        destroyed: function () {
            // clearTimeout(this.b);
        },
        name: "Upload"
    }
</script>

<style scoped>

</style>
